﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SP.OpenSource.CDC.Monitor
{
    public partial class Help : Form
    {
        String m_sHelpFile = String.Empty;
        String m_sFormTitle = "CDC Controller Help";

        public Help()
        {
            InitializeComponent();
        }

        public Help(String sURL)
        {
            InitializeComponent();
            m_sHelpFile = sURL;
        }
        private void Help_Load(object sender, EventArgs e)
        {
            try
            {
                String sExeFilePath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
                m_sHelpFile = sExeFilePath + @"\Help\" + m_sHelpFile;

                //wbHelp.Url = new Uri(m_sHelpFile); 
                if (true == System.IO.File.Exists(m_sHelpFile))
                {
                    wbHelp.DocumentText = System.IO.File.ReadAllText(m_sHelpFile);
                }
                else
                {
                    MessageBox.Show( "There was an issue displaying help.", m_sFormTitle,MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show("There was an issue displaying help.", m_sFormTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
            }
        }
    }
}
